package cn.zlb.frame.infrastructure.util.gateway.merchant;

import cn.zlb.frame.api.user.dto.MerchantQryRespDTO;
import cn.zlb.frame.application.repository.IMerchantRepository;
import cn.zlb.frame.common.result.Result;
import cn.zlb.frame.common.result.ResultBuilder;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * @author yangjie.deng@resico.cn
 * @date 2023-11-09 15:52:57
 * @describe class responsibility
 */
@Service
public class MerchantRepository implements IMerchantRepository {
    @Override
    public Result<Boolean> merchantVerify(String tenantNo) {
        // 查询数据库, 校验商户是否存在.

        return ResultBuilder.success(Boolean.TRUE);
    }

    @Override
    public Result<MerchantQryRespDTO> getMerchantInfo(String tenantNo, String merchantNo) {
        // 模拟数据查询, 将PO 转换为DTO

        MerchantQryRespDTO respDTO = new MerchantQryRespDTO();
        respDTO.setMerchantNo(merchantNo);
        respDTO.setAppId("alipay0001");
        respDTO.setReservePhoneNo("123456");
        respDTO.setSupportPayType(Arrays.asList(1,3));
        respDTO.setTenantNo(tenantNo);
        return ResultBuilder.success(respDTO);
    }
}
